-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert Gas price in USD #290
Conversation
execute/exectypes/costly_messages.go
Outdated
// feeComponents are in WEI (ETH * 1e18) | ||
executionFee := new(big.Int).Div( | ||
new(big.Int).Mul(feeComponents.ExecutionFee, nativeTokenPrice.Int), | ||
new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain this calculation in more detail, e.g. why we divide by 1e18?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the logic. First calculating the USD18/WEI (nativeTokenPrice/feeComponents.ExecutionFee) and then multiplying by the gas (in WEI) which will give a price in USD18
|
Link